import { createApp } from "vue"
import App from "./App.vue"
import router from "./router"
import store from "./store"

const app = createApp(App)

// 导入样式文件
import "./style/reset.scss"
import "./style/common.scss"

// 导入/components/common/common文件引入的公共组件
import { componentplugin } from "./components/common/common"
// 注册成全局组件
app.use(componentplugin)

// 导入ElementPlus全量包
import ElementPlus, { ElMessage, ElMessageBox } from "element-plus"
import "element-plus/dist/index.css"
import zhCn from "element-plus/dist/locale/zh-cn.mjs"
app.use(ElementPlus, {
  locale: zhCn
})

// 导入element-plus/icons-vue
import * as ElementPlusIconsVue from "@element-plus/icons-vue"
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

// 导入Symbol格式的iconfont图标
import "./assets/fonts/iconfont.js"

// 挂载全局方法moment
import moment from "moment"
app.config.globalProperties.$moment = moment

// 挂载全局方法ElMessage,ElMessageBox
app.config.globalProperties.$message = ElMessage
app.config.globalProperties.$messageBox = ElMessageBox

// 挂载全局对象lodash
import _ from "lodash"
app.config.globalProperties.$_ = _

app.use(store).use(router).mount("#app")
